package com.jhw.ymcc.feign;

import com.jhw.ymcc.domain.Login;
import com.jhw.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author jhw
 * @create 2022/9/26
 */
@Component
public class LoginServiceFallbackFactory implements FallbackFactory<LoginService> {

    @Override
    public LoginService create(Throwable throwable) {
        throwable.printStackTrace();
        return new LoginService() {
            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error("服务GG了，程序猿正在抢救！");
            }
        };
    }
}
